package com.xh.lesson.controller;


import com.xh.lesson.aop.annotation.LogAnnotation;
import com.xh.lesson.entity.THouseFunction;
import com.xh.lesson.service.THouseFunctionService;
import com.xh.lesson.utils.DataResult;
import com.xh.lesson.vo.resp.DeptRespNodeVO;
import io.swagger.annotations.ApiOperation;
import lombok.experimental.Accessors;
import org.apache.ibatis.annotations.Param;
import org.apache.shiro.authz.annotation.Logical;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import java.util.List;

/**
 * <p>
 * 前端控制器
 * </p>
 *
 * @author 柴&许
 * @since 2021-06-23
 */
@RestController
@RequestMapping("/sys")
public class THouseFunctionController {
    @Autowired
    private THouseFunctionService functionService;


    @GetMapping("/fun")
    public DataResult<THouseFunction> detailFun(){
        DataResult result = DataResult.success();
        result.setData(functionService.selectFun());
        return result;
    }
    @GetMapping("/fun/{id}")
    @LogAnnotation(title = "功能管理", action = "获取二级功能信息")
    public DataResult<THouseFunction> detailFunUse(@PathVariable("id")String id){
        DataResult result = DataResult.success();
        THouseFunction function = functionService.selectName(id);
        result.setData(functionService.selectFunUse(function.getFunid()));
        return result;
    }
//    @GetMapping("/fun/tree")
//    @ApiOperation(value = "树型组织列表接口")
//    @LogAnnotation(title = "机构管理",action = "树型组织列表")
//    @RequiresPermissions(value = {"sys:house:update","sys:house:add","sys:fun:add","sys:fun:update"},logical = Logical.OR)
//    public DataResult<List<DeptRespNodeVO>> getTree(@RequestParam(required = false) String deptId){
//        DataResult<List<DeptRespNodeVO>> result=DataResult.success();
//        result.setData(deptService.deptTreeList(deptId));
//        return result;
//    }


}

